package cn.edu.zafu.bigdata.yt;

public class StaticDemo_yt {
    static int count;
    int id;

    static {
        count = 0;
        System.out.println("Static block execute");
    }

    {
        id = count;
        count++;
        System.out.println("Instance block executed");
    }

    public StaticDemo_yt() {
        System.out.println("Constructor executed for ID: " + id);
    }

    public static void displayCount() {
        System.out.println("Total instances c:" + count);
    }

    public static void main(String[] args){
        StaticDemo_yt obj1 = new StaticDemo_yt();
        StaticDemo_yt obj2 = new StaticDemo_yt();
        StaticDemo_yt obj3 = new StaticDemo_yt();

        StaticDemo_yt.displayCount();
    }    
}
